import QtQuick 2.6
import QtQuick.Layouts 1.2

import "../../Base/UiBase"
import "../../Base/Config"

import "../../FallView" as FallView
import "../Post" as Post

Rectangle {
    id: root

    property alias head: header.head
    property alias name: header.name
    property alias description: header.description
    property alias nfocus: header.nfocus
    property alias nactive: header.nactive

    color: Color.background

    ColumnLayout {
        anchors.fill: parent
        spacing: Size.elementInterval
        CommunityHeader {
            id: header
            Layout.fillWidth: true
            Layout.preferredHeight: height
        }
        Item {
            z: -1
            Layout.fillWidth: true
            Layout.fillHeight: true
            FallView.FallView {
                visible: true
                anchors.fill: parent
                delegate: Post.AdvPost {
                    width: parent.width
                    username: model.username
                    headSource: model.head
                    subject: model.subject
                    time: model.time
                    location: model.location
                    imageCount: model.imageCount
                    imageSource: model.image
                    commentText: model.comment
                }
                model: ListModel {
                    id: listmodel
                    Component.onCompleted: {
                        listmodel.append({
                                             username: "欢乐的0403",
                                             head: "../../../resources/tests/touxiang02.svg",
                                             subject: Subject.Music,
                                             time: new Date().toISOString(),
                                             location: "广西 来宾",
                                             imageCount: 1,
                                             image: "../../../resources/tests/121025539394.jpg",
                                             comment: "123123"
                                         })
                        listmodel.append({
                                             username: "欢乐的0403",
                                             head: "../../../resources/tests/touxiang02.svg",
                                             subject: Subject.Music,
                                             time: new Date().toISOString(),
                                             location: "广西 来宾",
                                             imageCount: 1,
                                             image: "../../../resources/tests/355X630.jpg",
                                             comment: "123123"
                                         })
                        listmodel.append({
                                             username: "欢乐的0403",
                                             head: "../../../resources/tests/touxiang02.svg",
                                             subject: Subject.Music,
                                             time: new Date().toISOString(),
                                             location: "广西 来宾",
                                             imageCount: 8,
                                             image: "../../../resources/tests/355X400.jpg",
                                             comment: "123123"
                                         })
                    }
                }
            }
        }
    }
}
